DRAKHYSYS INFINITY TILESET WORKBENCH V4.7 — UI INTERFACE / NEW GAME FLOW EDITOR
================================================================================

Purpose
-------
Build and edit a custom BG2EE start/interface menu visually instead of hand-editing UI.menu.

Main flow supported
-------------------
Place Button -> Choose Destination/Action -> Character Creation / Import -> Difficulty -> Start Area

What the editor can do
----------------------
- Load an existing UI.menu as the safe base.
- Choose a PNG/JPG interface image and export it as a 1024x768 MOS V1 background.
- Rename the custom menu and title.
- Add, delete, rename and DRAG buttons directly on the 1024x768 preview.
- Edit exact button X/Y/W/H values.
- Choose what each button does:
  * New Game -> standard character creation/import -> standard difficulty -> selected area.
  * Open another UI menu.
  * Load Game.
  * Import Character.
  * Options.
  * Back.
  * Custom UI action.
- Choose the final ARE after character creation.
- Choose a named entrance such as START and resolve its X/Y from the ARE.
- Scan area names from chitin.key and loose ARE files in override.
- Insert/update the Planetar-style entry button on the normal START menu.
- Save/load the visual editor project as JSON.

Standalone campaign safety
--------------------------
A New Game button uses a custom campaign ID and does NOT need to initialize SoA.
The generated action uses OnCampaignButtonClick(custom_campaign, true), followed by the normal New Game flow.
The campaign row points to generated custom STARTARE / STARTPOS tables.

To preserve the stock CAMPAIGN.2DA rows, give the editor either:
1. chitin.key + the game root (recommended: the editor extracts stock CAMPAIGN.2DA from its BIF), or
2. an explicit base CAMPAIGN.2DA, or
3. an already-existing CAMPAIGN.2DA in the selected output/override folder.

If none of those exists, the editor can build a minimal custom CAMPAIGN.2DA containing the new campaign rows only.

Recommended workflow
--------------------
1. Open UI INTERFACE / NEW GAME FLOW EDITOR.
2. Choose the working UI.menu.
3. Choose the interface PNG/JPG.
4. Choose chitin.key and the BG2EE game root.
5. Choose the active override folder.
6. Click SCAN AVAILABLE AREAS.
7. Add/select a button and drag it on the image.
8. Set Destination type = New Game -> Character Creation -> Difficulty -> Start Area.
9. Set a unique Campaign ID, for example DRAKHYSYS.
10. Choose Start area, for example DR0001.
11. Choose entrance START and click RESOLVE ENTRANCE FROM ARE.
12. Export to a CLEAN test override.

Typical generated files
-----------------------
UI.menu
DRAKSTRT.MOS (or the background resref you chose)
DRAKSTRT_PREVIEW.png
CAMPAIGN.2DA
DUIA001.2DA / DUIP001.2DA for the first New Game button
DUIA002.2DA / DUIP002.2DA for the second New Game button, etc.
DUIREPORT.json

Important
---------
- The editor replaces its own managed menu block on later exports instead of stacking duplicates.
- It also removes the older Drakhysys Planetar V2 entry when migrating an older UI.menu.
- Use a clean override while testing. Old UI.menu copies in other active override folders can cause parser errors.
- A custom campaign ID must be unique for every New Game button that uses a different start setup.
